package com.yd.controller.yd;


import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yd.pojo.Orders;
import com.yd.service.OrdersService;
import com.yd.tool.UtsReg;


@Controller
public class OrdersControllerYD {

	@Resource
	private OrdersService ordersService;

	@RequestMapping(value={"/app/orders/yundanhao/getyundanhao"})
	@ResponseBody
	public String app_orders_yundanhao_getyundanhao(HttpServletRequest request) {
		JSONObject jsonObject = new JSONObject();

		String key = "";
		String yundanhao = "";
		if (UtsReg.getStringKB(request.getParameter("key"))){key = request.getParameter("key").trim();} else {jsonObject.put("msg","key错误");jsonObject.put("error", "1");return jsonObject.toString();}
		if (UtsReg.getStringKB(request.getParameter("yundanhao"))){yundanhao = request.getParameter("yundanhao").trim();} else {jsonObject.put("msg","yundanhao错误");jsonObject.put("error", "1");return jsonObject.toString();}
		
		if(!key.equals("yydd")){
			jsonObject.put("msg","key不正确");jsonObject.put("error", "1");return jsonObject.toString();
		}
		
		Orders orders=ordersService.selectOne(new EntityWrapper<Orders>().eq("yundanhao", yundanhao));
		if(orders==null){
			jsonObject.put("msg","yundanhao不正确");jsonObject.put("error", "1");return jsonObject.toString();
		}
		
		orders.setYundanhao("");
		jsonObject.put("data",orders);
		jsonObject.put("msg", "成功");
		jsonObject.put("error", "0");
		return jsonObject.toString();
	}
	
}


















